﻿{template 'web/_header'}

{template 'web/order/tabs'}

<style type='text/css'>

       .trhead td {  background:#efefef;text-align: center}

       .trbody td {  text-align: center; vertical-align:top;border-left:1px solid #ccc;}

</style>

<div class="panel panel-default">

    <div class="panel-body">

        <form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">

            <input type="hidden" name="c" value="site" />

            <input type="hidden" name="a" value="entry" />

            <input type="hidden" name="m" value="ewei_shop" />

            <input type="hidden" name="do" value="order" />

            <input type="hidden" name="status" value="{$status}" />

            <input type="hidden" name="agentid" value="{$_GPC['agentid']}" />

            <input type="hidden" name="refund" value="{$_GPC['refund']}" />  

            <div class="form-group">

                <div class="col-sm-8 col-lg-9 col-xs-12">

                    <div class='input-group'>
                        {if $_GPC['status']==6}
                        <div class='input-group-addon'>店铺信息</div>

                        <input class="form-control" name="realname" type="text" value="{$_GPC['realname']}" placeholder="可搜索昵称/姓名/手机号">
                        {/if}
                        <div class='input-group-addon'>订单号</div>

                        <input class="form-control" name="keyword" type="text" value="{$_GPC['keyword']}" placeholder="订单号">

                        <div class='input-group-addon'>快递单号</div>

                        <input class="form-control" name="expresssn" type="text" value="{$_GPC['expresssn']}" placeholder="快递单号">

                        <div class='input-group-addon'>用户信息</div>

                        <input class="form-control" name="member" type="text" value="{$_GPC['member']}" placeholder="用户手机号/姓名/昵称, 收件人姓名/手机号 ">

                        <div class='input-group-addon'>支付方式</div>

                        <select name="paytype" class="form-control">

                            <option value="" {if $_GPC['paytype']==''}selected{/if}>不限</option>

                            {loop $paytype $key $type}

                            <option value="{$key}" {if $_GPC['paytype'] == "$key"} selected="selected" {/if}>{$type['name']}</option>

                            {/loop}

                        </select>

                    </div>

                </div>

            </div> 

            <div class="form-group">



                <div class="col-sm-6">



                    <div class='input-group'>



                        <div class='input-group-addon'>下单时间

                            <label class='radio-inline' style='margin-top:-7px;'>

                                <input type='radio' value='0' name='searchtime' {if $_GPC['searchtime']=='0'}checked{/if}>不搜索

                            </label>

                            <label class='radio-inline'  style='margin-top:-7px;'>

                                <input type='radio' value='1' name='searchtime' {if $_GPC['searchtime']=='1'}checked{/if}>搜索

                            </label>

                        </div>

                        {php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}

                    </div>

                </div>



                {if !empty($agentid) && $level>0}   

                <div class="col-sm-3">

                    <div class='input-group'>

                        <div class='input-group-addon'>分销订单级数</div>

                        <select name="olevel" class="form-control">

                            <option value="" >不限</option>

                            <option value="1" {if $_GPC['olevel'] ==1} selected="selected" {/if}>一级订单</option>

                            <option value="2" {if $_GPC['olevel'] ==2} selected="selected" {/if}>二级订单</option>

                            <option value="3" {if $_GPC['olevel'] ==3} selected="selected" {/if}>三级订单</option>

                        </select>

                    </div>    </div>

                {/if}



            </div>



            <div class="form-group">



                <div class="col-sm-7 col-lg-9 col-xs-12">

                    <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>

                    <input type="hidden" name="token" value="{$_W['token']}" />

                    <button type="submit" name="export" value="1" class="btn btn-primary">导出 Excel</button>

                <!--

                    zhaoyun

                    2016/6/17

                  	后台--待发货--关闭订单的恢复操作

                --> 

                    <button class="btn btn-default">搜索</button>        

                <!--

                	后台--待发货--关闭订单的恢复操作结束

                -->

                </div>

            </div>
     
        </form>
        {if $_GPC['status']==1}
        <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" >
                <div class="col-sm-7  col-xs-12">
                <input type="file"  style="float:left;margin-right:10px;" name="import_expro" id="inputfile" class="btn btn-primary"/>
                <input type="submit" name="submit_expro" value="批量发货" class="btn btn-primary col-lg-1"  />
                <input type="submit" name="submit_modal" value="导出模板" class="btn btn-primary col-lg-1" style="margin-left:10px;" />
                </div>
        </form>
        {/if}
    </div>

</div>

        <table class='table' style='float:left;border:1px solid #ccc;margin-bottom:5px;table-layout: fixed'>

                <tr class='trhead'>

                    <td colspan='3'  style='text-align:left;'>订单数: {$total} 订单金额:

                    {if !empty($agentid)}总佣金: {$totalcommission}

                    {else}总购买积分: {$totalcredit}

                    {/if}

                    </td>

                    <td >规格及编码</td>

                    <td >单价(元)</td>

                    <td >数量</td>

                    <td >买家</td>

                    <td >支付方式</td>

                    <td>配送方式</td>

                    <td >价格</td> 

                    {if !empty($agentid)}

                    <td>返佣体现</td>

                    {else}

                    <td>赠送积分</td>

                    {/if}            

                    <td  >状态</td>

                    <td>操作</td>

                </tr>

            </table>

                {loop $list $item}

                {if count($item['goods']) == 1}

  <table class='table' style='float:left;border:1px solid #ccc;margin-top:5px;margin-bottom:5px;table-layout: fixed'>

                <tr >

                    <td colspan='12'  style='border-bottom:1px solid #ccc;background:#efefef;'> 

                        <b>订单编号:</b>  {$item['ordersn']}     

                        <b>下单时间:  </b>{php echo date('Y-m-d H:i:s', $item['createtime'])}

                        {if $item['TotalId'] >1 }

                        <label class='label label-danger'>子订单</label>

                        <label class='label label-danger'>总订单ID:{php echo $item['TotalId'];}</label>

                        {/if}
                        {if $_GPC['status']==6}
                        <label class='label label-danger'>店铺名称：{php echo $item['shopname'];}</label>
                        {/if}
                         {if !empty($item['refundid'])}<label class='label label-danger'>退款申请</label>{/if}

                    <td style='border-bottom:1px solid #ccc;background:#efefef;text-align: center' >

                          {if empty($item['statusvalue'])}

                            {ifp 'order.op.close'}

                                  <a class="btn btn-default btn-sm" href="javascript:;" onclick="$('#modal-close').find(':input[name=id]').val('{$item['id']}')" data-toggle="modal" data-target="#modal-close">关闭订单</a>

                            {/if}

                            {elseif $item['statusvalue'] == 1}

                                  <a class="btn btn-default btn-sm" href="javascript:;" onclick="$('#modal-close').find(':input[name=id]').val('{$item['id']}')" data-toggle="modal" data-target="#modal-close">关闭订单</a>

                            {/if}

                    </td>

                </tr>

                {loop $item['goods'] $k $g}

                <tr class='trbody'>

                    <td valign='top'  colspan='3' style='border-left:none;text-align: left;' style='width:200px;'>

                        <a href="{php echo $this->createWebUrl('shop/goods', array('id' => $g['id'], 'op' => 'post'))}"><img src="{php echo tomedia($g['thumb'])}" style="width: 50px; height: 50px;border:1px solid #ccc;padding:1px;"> 

                        {$g['title']}

                        </a> 

                    </td>

                    <td style='border-left:none'>{if !empty($g['optiontitle'])}<span class="label label-primary">{$g['optiontitle']}</span>{/if}

                        <br/>{$g['goodssn']}</td>

                    <td style='border-left:none'>原价: {php echo $g['price']/$g['total']} <br/>折后: {php echo $g['realprice']/$g['total']}</td>

                    <td style='border-left:none'>{$g['total']}</td>

                    {if $k==0}

                    <td rowspan="{php echo count($item['goods'])}" > {$item['realname']}<br/>{$item['mobile']}</td>

                    <td rowspan="{php echo count($item['goods'])}" ><label class='label label-{$item['css']}'>{$item['paytype']}</label></td>

                    <td  rowspan="{php echo count($item['goods'])}">{$item['dispatchname']}</td>

                    <td style='text-align:right;'  rowspan="{php echo count($item['goods'])}">{$item['price']} 元<br/>运费: {$item['dispatchprice']} 元

                    {if $item['deductprice']>0}

                    <br/>积分抵扣: {$item['deductprice']} 元

                    {/if}

                    {if $item['deductcredit2']>0}

                    <br/>余额抵扣: {$item['deductcredit2']} 元

                    {/if}

                    {if $item['deductenough']>0}

                    <br/>满额立减: {$item['deductenough']} 元

                    {/if}

                    {if $item['youhuiquan']>0}

                    <br/>优惠券: {$item['youhuiquan']} 元

                    {/if}

                    </td>

                    {if !empty($agentid)}

                    <td>{$item['commission']}元</td>

                    {else}

                    <td>{$item['credit']}</td>

                    {/if}

                    <td   rowspan="{php echo count($item['goods'])}" ><label class='label label-{$item['statuscss']}'>{$item['status']}</label><br />

                    <a href="{php echo $this->createWebUrl('order', array('op' => 'detail', 'id' => $item['id']))}" >查看详情</a></td>

                            <td   rowspan="{php echo count($item['goods'])}" >

                           {template 'web/order/ops'}

                            </td>

                                       {/if} 

                </tr>

                {/loop}

   </table>

           {/if}

            {/loop}

                    {$pager}

         {template 'web/order/modals'}

        {template 'web/_footer'}

